<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>合作商管理</title>
    <meta name="description" content="这是一个合作商管理页面">
    <meta name="keywords" content="合作商">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="stylesheet" href="${contextPath}/assets/css/amazeui.min.css"/>
    <link rel="stylesheet" href="${contextPath}/assets/css/amazeui.datatables.min.css"/>
    <link rel="stylesheet" href="${contextPath}/assets/css/app.css">
    <script src="${contextPath}/assets/js/jquery.min.js"></script>
    <style>
        .am-u-sm-4{height:35px;}
        .widget-body{margin-top: -20px}
    </style>
</head>

<body data-type="widgets">
<script src="${contextPath}/assets/js/theme.js"></script>
<div class="am-g tpl-g">
    <!-- 头部 -->
    <#include "/pc/common/header.html"/>
    <!-- 侧边导航栏 -->
    <#include "/pc/common/left.html"/>
    <!-- 内容区域 -->
    <div class="tpl-content-wrapper">
        <div class="row-content am-cf">
            <div class="row">
                <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                    <div class="widget am-cf">
                        <ol class="am-breadcrumb widget-head">
                            <li><a href="${contextPath}/index.htm" class="am-icon-home">首页</a></li>
                            <li>合作商管理</li>
                            <li>合作商查询</li>
                            <div class="am-btn-group-xs am-btn-group" style="float: right">
                                <button type="button" class="am-btn am-btn-secondary"
                                        onclick="search_b()"><span class="am-icon-search"></span>搜索
                                </button>
                                <a href="${contextPath}/merchant/list.htm" class="am-btn am-btn-warning">
                                    <span class="am-icon-refresh"></span>清空
                                </a>
                                <a class="am-btn am-btn-default am-btn-success" href="${contextPath}/merchant/modify.htm">
                                    <i class="am-icon-plus"></i> 新增
                                </a>
                            </div>
                        </ol>
                        <div class="widget-body  am-fr">
                            <div class="am-u-sm-12">
                                <div class="am-g">
                                    <#if Session.manager_js == 2>
                                    <div class="am-u-sm-4 am-form-inline">
                                        <label for="cityid" class="am-form-label">归属城市：</label>
                                        <div class="am-form-group">
                                            <select id="cityid" class="am-form-field" style="width: 185px;color: #a4a4a4;"
                                                    name="cityId">
                                                <#if vo.cityid??>
                                                    <#assign cityid="${vo.cityid?c}" />
                                                </#if>
                                                ${dict.getCityOptions(cityid)}
                                            </select>
                                        </div>
                                    </div>
                                    </#if>
                                    <div class="am-u-sm-4 am-form-inline">
                                        <label for="mtname" class="am-form-label">合作商名称：</label>
                                        <div class="am-form-group">
                                            <input type="text" class="am-form-field" id="mtname"
                                                   placeholder="输入合作商名称" value="${vo.mtname!''}">
                                        </div>
                                    </div>
                                    <div class="am-u-sm-4 am-form-inline">
                                        <label for="contact" class="am-form-label">负责人姓名：</label>
                                        <div class="am-form-group">
                                            <input type="text" class="am-form-field" id="contact"
                                                   placeholder="输入联系电话" value="${vo.contact!''}">
                                        </div>
                                    </div>
                                    <div class="am-u-sm-4 am-form-inline">
                                        <label for="landline" class="am-form-label">店内座机：</label>
                                        <div class="am-form-group">
                                            <input type="text" class="am-form-field" id="landline"
                                                   placeholder="选择城市" value="${vo.landline!''}">
                                        </div>
                                    </div>
                                    <div class="am-u-sm-4 am-form-inline ">
                                        <label for="tel" class="am-form-label">负责人手机号：</label>
                                        <div class="am-form-group">
                                            <input type="text" class="am-form-field" id="tel"
                                                   placeholder="输入合作商名称" value="${vo.tel!''}">
                                        </div>
                                    </div>
                                    <div class="am-u-sm-4 am-form-inline am-u-end">
                                        <label class="am-form-label">注册时间：</label>
                                        <div class="am-form-group">
                                            <input type="text" id="starttime" class="am-form-field" style="width: 100px;float: left"
                                                   placeholder="开始时间" <#if vo.starttime??>value="${vo.starttime?string('yyyy-MM-dd')}"</#if> data-am-datepicker><input id="endtime" type="text" class="am-form-field" style="width: 100px;float: left;margin-left: 5px"
                                                                                                                                                                       placeholder="结束时间" <#if vo.endtime??>value="${vo.endtime?string('yyyy-MM-dd')}"</#if> data-am-datepicker>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="am-u-sm-12" style="border-top: 1px solid #eef1f5;padding-top: 10px;margin-top: 10px">
                                <table width="100%"
                                       class="am-table am-table-compact am-table-striped tpl-table-black am-text-nowrap am-scrollable-horizontal am-table-centered"
                                       id="example-r">
                                    <thead>
                                    <tr>
                                        <th width="">合作商名称</th>
                                        <th width="">归属城市</th>
                                        <th width="">负责人姓名</th>
                                        <th width="">负责人手机号</th>
                                        <th width="">店内座机</th>
                                        <th width="">所在省份</th>
                                        <th width="">所在城市</th>
                                        <th width="">所在区县市</th>
                                        <th width="">抽成比例</th>
                                        <th width="">注册时间</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <#list page as l>
                                        <tr class="gradeX">
                                            <td>
                                                <a href="${contextPath}/merchant/qrcode.htm?id=${l.id!}" >
                                                ${l.mtname!''}
                                                </a>
                                            </td>
                                            <td><#if l.cityid??>${dict.getCityName(l.cityid?c)}</#if></td>
                                            <td>${l.contact!''}</td>
                                            <td>${l.tel!''}</td>
                                            <td>${l.landline!''}</td>
                                            <td>${l.provincename!''}</td>
                                            <td>${l.cityname!''}</td>
                                            <td>${l.regionname!''}</td>
                                            <td>
                                                <#if l.clearprop??>
                                                    ${(l.clearprop/100)?string("%.00")}
                                                </#if>
                                            </td>
                                            <td>
                                                <#if l.createtime??>
                                                    ${l.createtime?string('yyyy-MM-dd HH:mm:ss')}
                                                </#if>
                                            </td>
                                            <td>
                                                <div class="tpl-table-black-operation">
                                                    <a href="${contextPath}/merchant/modify.htm?id=${l.id!}">
                                                        <i class="am-icon-pencil"></i> 修改
                                                    </a>
                                                    <#if l.enable?? && l.enable==1>
                                                        <a href="javascript:;" onclick="active_b(${l.id!},2)" class="tpl-table-black-operation-del">
                                                            <i class="am-icon-toggle-off"></i> 下线
                                                        </a>
                                                        <#elseif l.enable?? && l.enable==2>
                                                            <a href="javascript:;" onclick="active_b(${l.id!},1)" class="tpl-table-black-operation-change">
                                                                <i class="am-icon-toggle-on"></i> 激活
                                                            </a>
                                                    </#if>
                                                </div>
                                            </td>
                                        </tr>
                                    </#list>
                                    </tbody>
                                </table>
                            </div>
                            <#include "/pc/common/page.html">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
<#include "/pc/common/alert.html" />
<script src="${contextPath}/assets/js/amazeui.min.js"></script>
<script src="${contextPath}/assets/js/amazeui.datatables.min.js"></script>
<script src="${contextPath}/assets/js/dataTables.responsive.min.js"></script>
<script src="${contextPath}/assets/js/amazeui.page.js"></script>
<script src="${contextPath}/assets/js/app.js"></script>
<script>
    var search_b = function () {
        var mtname = $("#mtname").val();
        var contact = $("#contact").val();
        var tel = $("#tel").val();
        var landline = $("#landline").val();
        var cityid = $("#cityid").val();
        var starttime = $("#starttime").val();
        var endtime = $("#endtime").val();
        var url = "${contextPath}/merchant/list.htm?mtname=" + mtname + "&contact=" + contact + "&tel=" + tel + "&landline=" + landline + "&starttime="+starttime+"&endtime="+endtime;
        if(cityid){
            url += "&cityid=" + cityid;
        }
        location.href = url;
    }
    function active_b(id, enable) {
        var msg = "你确定要激活这个合作商吗？";
        if (enable == 2) {
            msg = "你确定要下线这个合作商吗？";
        }
        Mconfirm(msg, function () {
            $.ajax({
                url: "${contextPath}/merchant/active.htm?id=" + id + "&enable=" + enable,
                type: "get",
                dataType: "json",
                success: function (data) {
                    var json = $.parseJSON(data);
                    Malert(json.errMessage, function () {
                        location.reload();
                    });
                }
            });
        });
    }
</script>
</body>

</html>